
def sum_numbers(numbers: list[int]) -> int:
    return sum(numbers)

if __name__ == "__main__":
    pass
    classmates = ['张三', '王五']
    print(len(classmates))
    print(classmates)
    classmates.append('李四')
    print(classmates)

    hash_set = set(classmates)
    print(hash_set)

    hash_set_2 = {'lisa', 'bob'}
    hash_set_2.add('王五')
    hash_set_2.remove('lisa')
    print(hash_set_2)

    strs = "we are family today"
    strs += " hallo queen"
    print(strs)

    reversed_strs = reversed(strs) # 返回迭代器对象.

    temp = ''
    list_strs = []
    for item in reversed_strs:
        if item != ' ':
            temp += item
        else:
            list_strs.append(temp)
            temp = ''

    # 用空格连接所有字符串，最后整体输出并换行
    # join函数：将一个可迭代的字符串序列（列表、元组等）连接成1个单一的字符串。
    print(' '.join(list_strs))
    print(', '.join(list_strs))
    print('\n'.join(list_strs))

    print("hello world", end=' ') # 使用end，控制print输出的最后1个字符是什么！
    print("hello world", end='\n')

    nums = [1, 2, 3 ]
    # print(' '.join(nums)) # 只能连接字符串，不能链接数字

    # map(function, iterable) # 将迭代器的每一个元素应用function函数。
    print(' '.join(map(str, nums))) # 类型转换


    print(sum(nums))